package com.zcpt.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zcpt.mapper.AddressMapper;
import com.zcpt.order.IAddressService;
import com.zcpt.pojo.order.Address;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;
@Service
public class AddressServiceImpl implements IAddressService {
    @Autowired
    private AddressMapper addressMapper;
    //根据用户id查询所有的收货地址
    @Override
    public List<Address> findByUserId(Integer user_id) {
        List<Address> addressList = addressMapper.selectList(new QueryWrapper<Address>().
                eq("user_id", user_id));
        return addressList;
    }

    //添加新的收货地址
    @Override
    public void addAddress(Address address) {
        addressMapper.insert(address);
    }
}
